﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace JMDCMS.Library.Win
{
    public partial class WinPartBase : UserControl
    {
        private BindingNavigator _mainBN;

        public BindingNavigator MainBN
        {
            get { return _mainBN; }
            set { _mainBN = value; }
        }

        public WinPartBase()
        {
            InitializeComponent();
            InitializeNavigator();
        }

        private void InitializeNavigator()
        {
            //_mainBN.AddNewItem = null;
            //_mainBN.DeleteItem = null;
            //_mainBN.DeleteItem.Enabled = true;
            //_mainBN.AddNewItem.Enabled = true;
        }

        partial void Save();

        #region Data binding helpers

        protected void UnbindBindingSource(BindingSource source, bool apply, bool isRoot)
        {
            System.ComponentModel.IEditableObject current =
              source.Current as System.ComponentModel.IEditableObject;
            if (isRoot)
                source.DataSource = null;
            if (current != null)
                if (apply)
                    current.EndEdit();
                else
                    current.CancelEdit();
        }

        #endregion

    }
}
